package com.student.education.controller;

import com.student.education.common.CommonPage;
import com.student.education.common.CommonResult;
import com.student.education.service.CountAnalysisService;
import com.student.education.to.*;
import com.student.education.vo.AnalysisVo;
import com.student.education.vo.CountAnalysisNewVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author 杨豹
 * @create 2021/10/13 0013 20:14
 * @description 描述
 */
@RestController
@RequestMapping("/analysis")
public class CountAnalysisController {
    @Resource
    private CountAnalysisService countAnalysisService;

    /**
     * 通过主键查询单条数据
     *
//     * @param userIds 主键
     * @return 单条数据
     */
//    @PostMapping("/situationCount")
//    public CommonResult<CountAnalysisTo> queryById(@RequestBody List<Integer> userIds) {
//        return CommonResult.success(this.countAnalysisService.queryById(userIds));
//    }
    //首页左
    @PostMapping("/situationCount")
    public CommonResult<CountAnalysisNewTo> queryById(@RequestBody CountAnalysisNewVo vo) {
        return CommonResult.success(this.countAnalysisService.queryByIdNew(vo));
    }
    //首页中
    @PostMapping("/situationCountScore")
    public CommonResult<CommonPage<ExamScoreQueryTo>> situationCountScore(@RequestBody CountAnalysisNewVo vo) {
        return CommonResult.success(this.countAnalysisService.situationCountScore(vo));
    }
    //首页右边
    @PostMapping("/consumptionCount")
    public CommonResult<ConsumptionCountTo> consumptionCount(@RequestBody CountAnalysisNewVo vo) {
        return CommonResult.success(this.countAnalysisService.consumptionCount(vo));
    }

    /**
     * 分析数据
     * @param vo
     * @return
     */
    @PostMapping("/situationAnalysis")
    public CommonResult<AnalysisTo> situationAnalysis(@RequestBody AnalysisVo vo) {
        return CommonResult.success(this.countAnalysisService.situationAnalysis(vo));
    }

    /**
     * 查询我名下的学生
     * @param userId
     * @return
     */
    @GetMapping("/selectMyStudents")
    public CommonResult<List<MyClassStudentTo>> selectMyStudents(Integer userId) {
        return CommonResult.success(this.countAnalysisService.selectMyStudents(userId));
    }

}
